

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
<script type="text/javascript" src="helpman_topicinit.js"></script>

<title>Generate a Single Class [Enterprise Architect User Guide]</title>

<meta name="keywords" content="Enterprise Architect, Sparx Systems, UML, Code Engineering,Code Engineering Generate Code For Single Class">
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<meta http-equiv="Content-Style-Type" content="text/css" />

<link type="text/css" href="default.css" rel="stylesheet" />
<style type="text/css">
  A, A:Visited
  {
    color: #00F;
  }

  A:Active, A:Hover
  {
    color: #F00;
  }

  OL
  {
    margin: 5px 0 5px 48px;
  }

  UL
  {
    margin-bottom: 3px;
    margin-top: 0;
  }

  #nsr
  {
    background-color: #D4DFFF;
  }

  #nsr A
  {
    text-decoration: none;
  }

  #mainbody
  {
    padding: 8px;
  }

  .p_BodyText
  {
    padding: 5px 0;
  }
</style>



<style type="text/css" media="screen">
  BODY
  {
    background-color: #FFFFFF;
  }

  #nsr
  {
    padding: 6px 6px 0 6px;
    border-bottom: none;
    vertical-align: top;
    z-index: 2;
    visibility: visible;
    left: 0;
    top: 0;
    position: absolute;
  }

  #mainbody
  {
    left: 0;
    top: 0;
    margin: 0;
    position: absolute;
    padding: 10px;
    overflow: auto;
    height: 100%;
    z-index: 1;
    background-repeat: no-repeat;
    background-position: bottom right;
    background-attachment: fixed;
  }
</style>

<style type="text/css" media="print">
  #nsr
  {
    visibility: none;
  }

  #mainbody
  {
    overflow: visible;
  }
</style>
<script type="text/javascript" language="JavaScript" src="nonscroll.js"></script>

</head>
<body scroll="no">

<div id="page">



        <div id="content">
          <div id="content-inner">
          



  
          <div id="nsr">
            <table border="0" cellspacing="0" cellpadding="4" width="100%">
              <tr valign="top">
                <td align="left">
  


                  <p class="p_Heading1"><span class="f_Heading1">Generate a Single Class</span></p>



  
                </td>
                <td align="right">
                  <a href="introduction.htm" onmouseover="document.images.main.src='button_main_h.gif'" onmouseout="document.images.main.src='button_main.gif'">
                    <img name="main" src="button_main.gif" border=0 alt="Return to Introduction">
                  </a>&nbsp;
    
                  <a href="generatesourcecode.htm" onmouseover="document.images.prev.src='button_prev_h.gif'" onmouseout="document.images.prev.src='button_prev.gif'">
                    <img name=prev src="button_prev.gif" border=0 alt="Previous page" />
                  </a>&nbsp;
    
    
    
                  <a href="generateagroupofclasses.htm" onmouseover="document.images.next.src='button_next_h.gif'" onmouseout="document.images.next.src='button_next.gif'">
                    <img name=next src="button_next.gif" border=0 alt="Next page" />
                  </a>
    
    
                </td>
              </tr>
            </table>
          </div>
          <div id="mainbody">
  


                <p class="p_BodyText"><span class="f_BodyText">To generate code for a single Class, first ensure the design of the model element (Class or Interface) is complete. Also ensure you have added Inheritance connectors to parents and associations to other Classes that are used. Also add Inheritance connectors to Interfaces that your Class implements; Enterprise Architect offers the option to generate function stubs for all interface methods that a Class implements. Once the design is satisfactory, follow the steps below.</span></p>
<p class="p_SubHeadingL1"><span class="f_SubHeadingL1">Generate Code for a Single Class</span></p>
<ol style="text-indent: 0px; margin-left: 48px; list-style-position: outside;">
<li value=1><span class="f_NumberedList">Open the diagram containing the Class or Interface for which to generate code.</span></li>
<li value=2><span class="f_NumberedList">Right-click on the required Class or Interface to display the context menu and select the </span><span class="f_MenuKeyField">Generate Code</span><span class="f_NumberedList"> menu option, or press</span><span class="f_MenuKeyField"> [F11]</span><span class="f_NumberedList">. The </span><span class="f_UIControl">Generate Code</span><span class="f_NumberedList"> dialog displays, which enables you to control how and where your source code is generated</span><span class="f_BodyText">.</span><br>
<span class="f_NumberedList">&nbsp;</span><br>
<img src="generatesingleelement.png" width="554" height="349" border="0" alt="GenerateSingleElement"><br>
<span class="f_NumberedList">&nbsp;</span></li>
<li value=3><span class="f_NumberedList">On the </span><span class="f_MenuKeyField">Path</span><span class="f_NumberedList"> field, click on </span><span class="f_MenuKeyField">[ ... ]</span><span class="f_NumberedList"> (Browse) and select a path name for your source code to be generated to.</span></li>
<li value=4><span class="f_Bulletlist1">In the </span><span class="f_MenuKeyField">Target Language</span><span class="f_Bulletlist1"> field, click on the drop-down arrow and select the language to generate; this becomes the permanent option for that Class, so change it back if you are only doing one pass in another language.</span></li>
<li value=5><span class="f_NumberedList">Click on the </span><span class="f_MenuKeyField">Advanced</span><span class="f_NumberedList"> button. The </span><span class="f_UIControl">Source Code Engineering</span><span class="f_NumberedList"> page of the </span><span class="f_UIControl">Options</span><span class="f_NumberedList"> dialog displays.</span><br>
<span class="f_NumberedList">&nbsp;</span><br>
<img src="generatecodeadvanced.png" width="652" height="390" border="0" alt="GenerateCodeAdvanced"><br>
<span class="f_NumberedList">&nbsp;</span></li>
<li value=6><span class="f_NumberedList">Set any custom options (for this Class alone), then click on the </span><span class="f_MenuKeyField">Close</span><span class="f_NumberedList"> button to return to the </span><span class="f_UIControl">Generate Code</span><span class="f_NumberedList"> dialog.</span></li>
<li value=7><span class="f_NumberedList">In the </span><span class="f_MenuKeyField">Import(s) / Header(s)</span><span class="f_NumberedList"> fields, type any import statements, </span><span class="f_NumberedList" style="font-style: italic;">#includes</span><span class="f_NumberedList"> or other header information. (Note that in the case of Visual Basic this information is ignored; in the case of Java the two import text boxes are merged; and in the case of C++ the first import text area is placed in the header file and the second in the body (.cpp) file.)</span></li>
<li value=8><span class="f_NumberedList">Click on the </span><span class="f_MenuKeyField">Generate</span><span class="f_NumberedList"> button to create the source code.</span></li>
<li value=9><span class="f_NumberedList">When complete, click on the </span><span class="f_MenuKeyField">View</span><span class="f_NumberedList"> button to see what has been generated. Note that you should set up your <a href="thesourcecodeviewer.htm">default viewer</a>/editor for each language type first. You can also set up the default editor on the</span><span class="f_Bulletlist1"> </span><span class="f_UIControl">DDL</span><span class="f_Bulletlist1"> </span><span class="f_NumberedList">page of the</span><span class="f_Bulletlist1"> </span><span class="f_UIControl">Options</span><span class="f_Bulletlist1"> </span><span class="f_NumberedList">dialog (</span><span class="f_MenuKeyField">Tools | Options | Source Code Engineering | Code Editors</span><span class="f_NumberedList">).</span></li>
</ol>




            </div>
          </div>
        </div>



</div>


</body>
</html>
